<template>
  <HomePanel title="热门品牌"
             sub-title="国际经典 品质保障">
    <template #main>
      <div class="xtx_goods">
        <ul class="brand-list">
          <li v-for="item in brandList"
              :key="item.id">
            <a href="javascript:;">
              <img v-imgLazy="item.picture"
                   alt="" />
            </a>
          </li>
        </ul>
      </div>
    </template>
  </HomePanel>
</template>

<script>
import HomePanel from './home-panel'
import { findBrand } from '@/api/home'
import { ref } from 'vue'
export default {
  components: {
    HomePanel
  },
  setup () {
    // 1.定义响应式数据
    const brandList = ref([])
    // 2.定义函数 函数内部调用接口函数
    async function getHotList () {
      const res = await findBrand()
      brandList.value = res.data.result
    }
    getHotList()
    return {
      brandList
    }
  }
}
</script>
<style lang="less" scoped>
.xtx_goods {
  height: 305px;
  overflow: hidden;
  .brand-list {
    display: flex;
    li {
      flex: 1;
      padding: 10px;
    }
  }
}
</style>
